<template>
  <view class="center" style="margin-top: 40rpx">
    <view class="hd center" style="">
      <view
        @click="gocommon"
        :class="version_control ? 'version-button' : 'check-button'"
      >
        简易版
      </view>
      <view
        @click="goprofession"
        :class="version_control ? 'check-button' : 'version-button'"
      >
        专业版
      </view>
    </view>
  </view>

  <!-- <view class="header">
	  <view class="version-change">
	    <button @click="gocommon" :class="version_control ? 'version-button' : 'check-button'" style="margin-right: 168.72rpx;">简易版</button>
	    <button @click="goprofession" :class="version_control ? 'check-button' : 'version-button'">专业版</button>
		
	  </view>
	  <view class="container">
	  	<view class="tips">
	  	  34项指标同时监测数据面板
	  	</view>
	  </view>
	  
	</view> -->
</template>

<script>
export default {
  name: "version-header",
  data() {
    return {};
  },
  props: {
    // 接收父组件传递的 version_control 属性
    version_control: {
      type: Boolean,
      default: false, // 默认值为 false
    },
  },
  methods: {
    goprofession() {
      // const isMember = uni.getStorageSync('userInfo')['isMember'];
      const isMember = true;
      console.log("我的会员状态是", isMember);
      const currentPage = getCurrentPages(); // 获取当前页面栈
      const currentRoute = currentPage[currentPage.length - 1].route; // 获取当前页面的路由
      if (isMember !== true) {
        uni.showModal({
          title: "提示",
          content: "成为会员方可进入专业版页面",
          showCancel: false,
          confirmText: "我已了解",
          success: (res) => {
            if (res.confirm) {
              // console.log('用户点击了确定');
              // 当弹窗关闭后，重置标志位，以便下次还能触发
              this.check_burden = false;
            }
          },
        });
        return;
      }
      if (currentRoute !== "pagesExtra/profession/profession") {
        uni.navigateTo({
          url: "/pagesExtra/profession/profession",
        });
      }
    },
    gocommon() {
      const currentPage = getCurrentPages(); // 获取当前页面栈
      const currentRoute = currentPage[currentPage.length - 1].route; // 获取当前页面的路由
      if (currentRoute !== "pagesExtra/login/login") {
        uni.navigateBack(); // 返回到上一页
      }
    },
  },
};
</script>

<style>
.center {
  display: flex;
  text-align: center;
  justify-content: center;
  align-items: center;
}
.container {
  width: 100%;
  white-space: nowrap;
  display: flex;
  justify-content: flex-end;
}
.tips {
  /* font-size: 10rpx; */
  margin: 0rpx;
  -webkit-transform: scale(0.7);
  color: rgba(140, 140, 140, 1);
}

.hd {

  width: 640rpx;
  height: 72rpx;

  border-radius: 18px;
  background: rgba(124, 124, 126, 0.08);
}
.header {
  height: 128.7rpx;
  padding-bottom: 2.79px;
  font-family: "优设标题黑";
}
.version-change {
  height: 90rpx;
  display: flex;
  justify-content: space-between;
}
.version-button {
  /* background: rgba(121, 72, 234, 0.5); */
  width: 316rpx;
  height: 90%;
  opacity: 1;
  border-radius: 36rpx;
  font-size: 40rpx;
  font-weight: 400;
  letter-spacing: 0px;
  line-height: 52rpx;
  color: rgba(124, 124, 126, 1);
  display: flex;
  text-align: center;
  justify-content: center;
  align-items: center;
}
.check-button {
  width: 316rpx;
  height: 90%;
  opacity: 1;
  border-radius: 36rpx;
  background: rgba(255, 255, 255, 1);

  font-size: 40rpx;
  font-weight: 400;
  letter-spacing: 0px;
  line-height: 26px;
  color: rgba(110, 88, 170, 1);
  display: flex;
  text-align: center;
  justify-content: center;
  align-items: center;
}
</style>
